
//递归树状数据
const recursionTree = (data: any, match: Array<any>, count: number, num=0) => {
  num++
  return data.map((item: any) => {
    const o: any = {}

    match.forEach((propname: Array<any>) => {
      o[propname[1]] = item[propname[0]]
    })

    if (item.children && num < count) {
      o.children = recursionTree(item.children, match, count, num)	//menuRecursion自己调用自己
    }

    return o
  })
}

export default {
  recursionTree
}